<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<!--登录和注册的模态框-->
<article th:fragment="mainModal">
    <!-- 个人信息模态框 -->
    <form class="form-horizontal" action="" id="model_form1"><!--保证样式水平不混乱-->
        <!-- 模态框（Modal） -->
        <div class="modal fade" id="updateInfo" tabindex="-1" role="dialog" aria-labelledby="ModalLabel" aria-hidden="true">
            <div class="modal-dialog" style="z-index: 1048">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title" id="ModalLabel">个人信息</h4>
                    </div>

                    <div class="modal-body">

                        <input type="hidden" name="id" th:value="${session.admin.id}">
                        <input type="hidden" name="password" th:value="${session.admin.password}">

                        <!--正文-->
                        <div class="form-group">
                            <label for="name" class="col-sm-3 control-label">用户名</label>
                            <div class="col-sm-7">
                                <input type="text" class="form-control" id="name" name="username" readonly th:value="${session.admin.name}">
                                <label class="control-label" for="name" style="display: none"></label>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="phone" class="col-sm-3 control-label">电话</label>
                            <div class="col-sm-7">
                                <input type="text" minlength="11" maxlength="11" class="form-control" onblur="checkPhone();" id="phone" name="phone"  placeholder="请输入您的联系号码" th:value="${session.admin.phone}">
                                <label class="control-label" for="phone" id="phoneErro" style="display: none"></label>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="email" class="col-sm-3 control-label">邮箱</label>
                            <div class="col-sm-7">
                                <input type="text" class="form-control" id="email" name="email"  placeholder="请输入您的邮箱" th:value="${session.admin.email}">
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="address" class="col-sm-3 control-label">地址</label>
                            <div class="col-sm-7">
                                <input type="text" required class="form-control" id="address" name="address"  placeholder="请输入您的地址" th:value="${session.admin.address}">
                            </div>
                        </div>
                        <!--正文-->

                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        <button type="button" class="btn btn-primary" onclick="updateInfo()">修改</button>
                    </div>
                </div>
            </div>
        </div>
    </form>
    <!--个人信息模态框结束-->

    <!--密码模态框 -->
    <form class="form-horizontal" id="model_form2"><!--保证样式水平不混乱-->
        <!-- 模态框（Modal） -->
        <div class="modal fade" id="updatePass" tabindex="-1" role="dialog" aria-labelledby="ModalLabel" aria-hidden="true">
            <div class="modal-dialog" style="z-index: 1048">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title" id="ModalLabel1">修改密码</h4>
                    </div>

                    <div class="modal-body">
                        <input type="hidden" name="id" th:value="${session.admin.id}">
                        <input type="hidden" name="phone" th:value="${session.admin.phone}">
                        <input type="hidden" name="name" th:value="${session.admin.name}">
                        <input type="hidden" name="email" th:value="${session.admin.email}">
                        <input type="hidden" name="address" th:value="${session.admin.address}">


                        <!--正文-->
                        <div class="form-group">
                            <label for="oldPass" class="col-sm-3 control-label">原密码</label>
                            <div class="col-sm-7">
                                <input type="password" class="form-control" id="oldPass" name="oldPass"  placeholder="请输入您的原密码">
                                <label class="control-label" for="oldPass" style="display: none"></label>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="newPass" class="col-sm-3 control-label">新密码</label>
                            <div class="col-sm-7">
                                <input type="password" class="form-control" id="newPass" name="password"  placeholder="请输入您的新密码">
                                <label class="control-label" for="newPass" style="display: none"></label>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="newPass1" class="col-sm-3 control-label">确认密码</label>
                            <div class="col-sm-7">
                                <input type="password" class="form-control" id="newPass1" name="newPass1"  placeholder="请输入您的新密码">
                                <label class="control-label" for="newPass1" style="display: none"></label>
                            </div>
                        </div>
                        <!--正文-->

                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        <button type="button" class="btn btn-primary" onclick="updatePass()">修改</button>
                    </div>
                </div>
            </div>
        </div>
    </form>
    <!--密码模态框结束-->

    <!--添加图书模态框开始-->
    <form class="form-horizontal" action="" id="model_addBook"><!--保证样式水平不混乱-->
        <!-- 模态框（Modal） -->
        <div class="modal fade" id="addbookInfo" tabindex="-1" role="dialog" aria-labelledby="ModalLabel-add-book" aria-hidden="true">
            <div class="modal-dialog" style="z-index: 1048">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title" id="ModalLabel-add-book">添加图书</h4>
                    </div>

                    <div class="modal-body">
                        <input type="hidden" name="imgUrl" value="" id="addImageUrl">

                        <div class="form-group">
                            <label for="isbn" class="col-sm-3 control-label">ISBN</label>
                            <div class="col-sm-7">
                                <input type="text" class="form-control" id="isbn" onblur="checkIsbn()" name="isbn">
                                <label class="control-label" id="err-isbn" for="isbn" style="display: none"></label>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="name" class="col-sm-3 control-label">图书名称</label>
                            <div class="col-sm-7">
                                <input type="text" class="form-control" id="name" name="name">
                                <label class="control-label" id="err-name" for="name" style="display: none"></label>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="file" class="col-sm-3 control-label">图书封面</label>
                            <div class="col-sm-7">
                                <input type="file" id="file" class="file" name="uploadFile" required/>
<!--                                <input type="file" class="form-control" id="imgUrl" name="imgUrl">-->
<!--                                <label class="control-label" id="err-imgUrl" for="imgUrl" style="display: none"></label>-->
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="oldPrice" class="col-sm-3 control-label">原价</label>
                            <div class="col-sm-7">
                                <input type="number" class="form-control" id="oldPrice" name="oldPrice">
                                <label class="control-label" id="err-oldPrice" for="oldPrice" style="display: none"></label>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="newPrice" class="col-sm-3 control-label">现价</label>
                            <div class="col-sm-7">
                                <input type="number" class="form-control" id="newPrice" name="newPrice">
                                <label class="control-label" id="err-newPrice" for="newPrice" style="display: none"></label>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="author" class="col-sm-3 control-label">作者</label>
                            <div class="col-sm-7">
                                <input type="text" class="form-control" id="author" name="author">
                                <label class="control-label" id="err-author" for="author" style="display: none"></label>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="publisher" class="col-sm-3 control-label">出版社</label>
                            <div class="col-sm-7">
                                <input type="text" class="form-control" id="publisher" name="publisher">
                                <label class="control-label" id="err-publisher" for="publisher" style="display: none"></label>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="authorLoc" class="col-sm-3 control-label">出版地</label>
                            <div class="col-sm-7">
                                <input type="text" class="form-control" id="authorLoc" name="authorLoc">
                                <label class="control-label" id="err-authorLoc" for="authorLoc" style="display: none"></label>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="publishDate" class="col-sm-3 control-label">出版时间</label>
                            <div class="col-sm-7">
                                <input type="date" class="form-control" id="publishDate" name="publishDate">
                                <label class="control-label" id="err-publishDate" for="publishDate" style="display: none"></label>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="category" class="col-sm-3 control-label">类型</label>
                            <div class="col-sm-7">
                                <select class="form-control" id="category" name="category">
                                    <option selected value="SELECTED">精选图书</option>
                                    <option value="RECOMMENDED">推荐图书</option>
                                    <option value="BARGAIN">特价图书</option>
                                </select>
                                <label class="control-label" id="err-category" for="category" style="display: none"></label>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="suit" class="col-sm-3 control-label">库存</label>
                            <div class="col-sm-7">
                                <select class="form-control" id="suit" name="suit">
                                    <option selected value="YES">充足</option>
                                    <option value="NO">缺货</option>
                                </select>
                                <label class="control-label" id="err-suit" for="suit" style="display: none"></label>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="info" class="col-sm-3 control-label">详细信息</label>
                            <div class="col-sm-7">
                                <textarea class="form-control" style="resize: vertical" id="info" name="info"></textarea>
                                <label class="control-label" id="err-info" for="info" style="display: none"></label>
                            </div>
                        </div>



                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        <button type="button" class="btn btn-primary" onclick="addBookInfo()">添加</button>
                    </div>
                </div>
            </div>
        </div>
    </form>
    <!--添加图书模态框结束-->

    <!--修改图书模态框开始-->
    <form class="form-horizontal" id="model_updateBookInfo" action=""><!--保证样式水平不混乱-->
        <!-- 模态框（Modal） -->
        <div class="modal fade" id="updateBookInfo" tabindex="-1" role="dialog" aria-labelledby="ModalLabel-update-book-info" aria-hidden="true">
            <div class="modal-dialog" style="z-index: 1048">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title" id="ModalLabel_update_Book">修改图书信息</h4>
                    </div>

                    <div class="modal-body">

                        <input type="hidden" id="bookId" name="id">
                        <input type="hidden" id="updateImgUrl" name="imgUrl">

                        <div class="form-group">
                            <label for="updateIsbn" class="col-sm-3 control-label">ISBN</label>
                            <div class="col-sm-7">
                                <input type="text" disabled class="form-control" id="updateIsbn" name="isbn">
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="updateName" class="col-sm-3 control-label">图书名称</label>
                            <div class="col-sm-7">
                                <input type="text" class="form-control" id="updateName" name="name">
                                <label class="control-label" id="err-updateName" for="updateName" style="display: none"></label>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="file" class="col-sm-3 control-label">图书封面</label>
                            <div class="col-sm-7">
                                <input type="file" id="uploadFile" class="file" name="uploadFile" required/>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="updateOldPrice" class="col-sm-3 control-label">原价</label>
                            <div class="col-sm-7">
                                <input type="number" class="form-control" id="updateOldPrice" name="oldPrice">
                                <label class="control-label" id="err-updateOldPrice" for="oldPrice" style="display: none"></label>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="updateNewPrice" class="col-sm-3 control-label">现价</label>
                            <div class="col-sm-7">
                                <input type="number" class="form-control" id="updateNewPrice" name="newPrice">
                                <label class="control-label" id="err-updateNewPrice" for="newPrice" style="display: none"></label>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="updateAuthor" class="col-sm-3 control-label">作者</label>
                            <div class="col-sm-7">
                                <input type="text" class="form-control" id="updateAuthor" name="author">
                                <label class="control-label" id="err-updateAuthor" for="author" style="display: none"></label>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="updatePublisher" class="col-sm-3 control-label">出版社</label>
                            <div class="col-sm-7">
                                <input type="text" class="form-control" id="updatePublisher" name="publisher">
                                <label class="control-label" id="err-updatePublisher" for="updatePublisher" style="display: none"></label>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="updateAuthorLoc" class="col-sm-3 control-label">出版地</label>
                            <div class="col-sm-7">
                                <input type="text" class="form-control" id="updateAuthorLoc" name="authorLoc">
                                <label class="control-label" id="err-updateAuthorLoc" for="authorLoc" style="display: none"></label>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="updatePublishDate" class="col-sm-3 control-label">出版时间</label>
                            <div class="col-sm-7">
                                <input type="date" class="form-control" id="updatePublishDate" name="publishDate">
                                <label class="control-label" id="err-updatePublishDate" for="updatePublishDate" style="display: none"></label>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="updateCategory" class="col-sm-3 control-label">类型</label>
                            <div class="col-sm-7">
                                <select class="form-control" id="updateCategory" name="category">
                                    <option selected value="SELECTED">精选图书</option>
                                    <option value="RECOMMENDED">推荐图书</option>
                                    <option value="BARGAIN">特价图书</option>
                                </select>
                                <label class="control-label" id="err-updateCategory" for="category" style="display: none"></label>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="updateSuit" class="col-sm-3 control-label">库存</label>
                            <div class="col-sm-7">
                                <select class="form-control" id="updateSuit" name="suit">
                                    <option selected value="YES">充足</option>
                                    <option value="NO">缺货</option>
                                </select>
                                <label class="control-label" id="err-updateSuit" for="suit" style="display: none"></label>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="update-Info" class="col-sm-3 control-label">详细信息</label>
                            <div class="col-sm-7">
                                <textarea class="form-control" style="resize: vertical" id="update-Info" name="info"></textarea>
                                <label class="control-label" id="err-update-Info" for="update-Info" style="display: none"></label>
                            </div>
                        </div>

                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        <button type="button" class="btn btn-primary" onclick="updateBookInfo()">修改</button>
                    </div>
                </div>
            </div>
        </div>
    </form>
    <!--修改图书信息模态框结束-->

    <!--修改用户模态框开始-->
    <form class="form-horizontal" action="" id="model_updateUser"><!--保证样式水平不混乱-->
        <!-- 模态框（Modal） -->
        <div class="modal fade" id="updateUser" tabindex="-1" role="dialog" aria-labelledby="ModalLabel-add-book" aria-hidden="true">
            <div class="modal-dialog" style="z-index: 1048">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title" id="ModalLabel-update-user">修改用户</h4>
                    </div>

                    <div class="modal-body">

                        <input type="hidden" name="id" id="userId">

                        <div class="form-group">
                            <label for="updateUsername" class="col-sm-3 control-label">用户名</label>
                            <div class="col-sm-7">
                                <input type="text" class="form-control" onblur="checkUserName()" id="updateUsername" name="username">
                                <label class="control-label" id="err-username" for="updateUsername" style="display: none"></label>

                            </div>
                        </div>

                        <div class="form-group">
                            <label for="updatePassword" class="col-sm-3 control-label">密码</label>
                            <div class="col-sm-7">
                                <input type="text" class="form-control" id="updatePassword" name="password">
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="updateEmail" class="col-sm-3 control-label">邮箱</label>
                            <div class="col-sm-7">
                                <input type="email" class="form-control" id="updateEmail" name="email">
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="updatePhone" class="col-sm-3 control-label">电话</label>
                            <div class="col-sm-7">
                                <input type="number" minlength="11" maxlength="11" class="form-control" id="updatePhone" name="phone">
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="updateCompany" class="col-sm-3 control-label">地址</label>
                            <div class="col-sm-7">
                                <input type="text" class="form-control" id="updateCompany" name="company">
                            </div>
                        </div>


                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        <button type="button" class="btn btn-primary" onclick="updateUser()">修改</button>
                    </div>
                </div>
            </div>
        </div>
    </form>
    <!--修改用户模态框结束-->


    <!--添加管理员模态框开始-->
    <form class="form-horizontal" action="" id="model_addAdmin"><!--保证样式水平不混乱-->
        <!-- 模态框（Modal） -->
        <div class="modal fade" id="addAdmin" tabindex="-1" role="dialog" aria-labelledby="ModalLabel-add-book" aria-hidden="true">
            <div class="modal-dialog" style="z-index: 1048">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title" id="ModalLabel-add-admin">添加管理员</h4>
                    </div>

                    <div class="modal-body">
                        <div class="form-group">
                            <label for="adminName" class="col-sm-3 control-label">用户名</label>
                            <div class="col-sm-7">
                                <input type="text" class="form-control" id="adminName" onblur="checkAdminName()" name="name">
                                <label class="control-label" id="err-adminName" for="adminName" style="display: none"></label>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="adminPas" class="col-sm-3 control-label">密码</label>
                            <div class="col-sm-7">
                                <input type="password" class="form-control" id="adminPas" name="password">
                                <label class="control-label" id="err-adminPas" for="adminPas" style="display: none"></label>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="adminEmail" class="col-sm-3 control-label">邮箱</label>
                            <div class="col-sm-7">
                                <input type="email" class="form-control" id="adminEmail" name="email">
                                <label class="control-label" id="err-adminEmail" for="adminEmail" style="display: none"></label>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="adminPhone" class="col-sm-3 control-label">电话</label>
                            <div class="col-sm-7">
                                <input type="number" class="form-control" id="adminPhone" name="phone">
                                <label class="control-label" id="err-adminPhone" for="adminPhone" style="display: none"></label>
                            </div>
                        </div>


                        <div class="form-group">
                            <label for="adminAddress" class="col-sm-3 control-label">地址</label>
                            <div class="col-sm-7">
                                <input type="text" class="form-control" id="adminAddress" name="address">
                                <label class="control-label" id="err-adminAddress" for="adminAddress" style="display: none"></label>
                            </div>
                        </div>

                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        <button type="button" class="btn btn-primary" onclick="addAdmin()">添加</button>
                    </div>
                </div>
            </div>
        </div>
    </form>
    <!--添加管理员模态框结束-->

    <!--修改管理员模态框开始-->
    <form class="form-horizontal" action="" id="model_updateAdmin"><!--保证样式水平不混乱-->
        <!-- 模态框（Modal） -->
        <div class="modal fade" id="updateAdmin" tabindex="-1" role="dialog" aria-labelledby="ModalLabel-add-book" aria-hidden="true">
            <div class="modal-dialog" style="z-index: 1048">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title" id="ModalLabel-update-admin">修改管理员</h4>
                    </div>

                    <input type="hidden" name="id" id="updateAdminId">

                    <div class="modal-body">
                        <div class="form-group">
                            <label for="updateAdminName" class="col-sm-3 control-label">用户名</label>
                            <div class="col-sm-7">
                                <input type="text" class="form-control" id="updateAdminName" name="name">
                                <label class="control-label" id="err-updateAdminName" for="updateAdminName" style="display: none"></label>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="updateAdminPas" class="col-sm-3 control-label">密码</label>
                            <div class="col-sm-7">
                                <input type="text" class="form-control" id="updateAdminPas" name="password">
                                <label class="control-label" id="err-updateAdminPas" for="updateAdminPas" style="display: none"></label>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="updateAdminEmail" class="col-sm-3 control-label">邮箱</label>
                            <div class="col-sm-7">
                                <input type="email" class="form-control" id="updateAdminEmail" name="email">
                                <label class="control-label" id="err-updateAdminEmail" for="updateAdminEmail" style="display: none"></label>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="updateAdminPhone" class="col-sm-3 control-label">电话</label>
                            <div class="col-sm-7">
                                <input type="number" class="form-control" id="updateAdminPhone" name="phone">
                                <label class="control-label" id="err-updateAdminPhone" for="updateAdminPhone" style="display: none"></label>
                            </div>
                        </div>


                        <div class="form-group">
                            <label for="updateAdminAddress" class="col-sm-3 control-label">地址</label>
                            <div class="col-sm-7">
                                <input type="text" class="form-control" id="updateAdminAddress" name="address">
                                <label class="control-label" id="err-updateAdminAddress" for="updateAdminAddress" style="display: none"></label>
                            </div>
                        </div>

                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        <button type="button" class="btn btn-primary" onclick="updateAdmin()">修改</button>
                    </div>
                </div>
            </div>
        </div>
    </form>
    <!--修改管理员模态框结束-->
</article>